<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>3_3_2-使用Lodash库进行函数限流</title>
</head>

<body>


  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <script src="https://unpkg.com/lodash@4.17.20/lodash.min.js"></script>

  <div id="Application">
    点击一次，两秒后可获取时间
    <button @click="p_click">按钮</button>
  </div>

  <script>
    const App = {
      //组件的方法
      methods: {
        //用Lodash函数
        p_click: _.debounce(function () {
          console.log(Date());
        }, 2000),
      },
    };

    Vue.createApp(App).mount("#Application");
  </script>
</body>

</html>